package com.cskaoyan.controller.dashboard;

import com.cskaoyan.model.vo.BaseRespVo;
import com.cskaoyan.model.vo.dashboard.DashboardData;
import com.cskaoyan.service.dashboard.DashboardService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;

/**
 * @program: project-market
 * @description:后台管理首页
 * @author: zhijie
 * @create: 2021-11-29 23:15
 **/
@RestController
public class DashboardController {
    @Autowired
    DashboardService dashboardService;

    /**
     * 首页的处理
     *
     * @return
     */
    @GetMapping("admin/dashboard")
    public BaseRespVo dashboard() {
        Serializable id = SecurityUtils.getSubject().getSession().getId();
        System.out.println(id);  //todo
        DashboardData data = dashboardService.dashboard();
        return BaseRespVo.ok(data);
    }


}
